#ifndef _SERPORT_H
#define _SERPORT_H

#include <inttypes.h>

typedef int serport_t;
#define SERPORT_INVALID (-1)

serport_t serport_open(const char *port);
void serport_close(serport_t hdl);
int serport_setmode(serport_t hdl, const char *mode);
int serport_getmode(serport_t hdl, char *mode, size_t mode_bufsize);
ssize_t serport_write(serport_t hdl, const uint8_t *buf, size_t count);
ssize_t serport_read(serport_t hdl, uint8_t *buf, size_t count);

#endif /* _SERPORT_H */

